package project2.entity.enemy;

import project2.config.Config;
import project2.config.ImageConstants;
import project2.resources.Images;
import project2.type.EnemyPlaneType;
import project2.ui.game.GamePlayingPanel;

import java.awt.*;

/**
 * 大飞机
 */
public class BigPlane extends EnemyPlane {

    public BigPlane(GamePlayingPanel getPlayingPanel, EnemyPlaneType enemyType) {
        super(getPlayingPanel, enemyType);
    }

    @Override
    public void drawFighting(Graphics g) {
        new Thread(() -> drawFightingRun(g)).start();
    }

    @Override
    public void drawKilled(Graphics g) {
        new Thread(() -> drawKilledRun(g)).start();
    }

    public void drawFightingRun(Graphics g) {
        this.setImage(Images.BIG_PLANE_FIGHTING_IMG);
        this.setWidth(ImageConstants.BIG_PLANE_FIGHTING_WIDTH);
        this.setHeight(ImageConstants.BIG_PLANE_FIGHTING_HEIGHT);
        super.draw(g);
        try {
            Thread.sleep(Config.BIG_PLANE_STATUS_CHANGE_INTERVAL);
        } catch (InterruptedException ignore) {

        }
    }

    public void drawKilledRun(Graphics g) {
        this.setImage(Images.BIG_PLANE_HITTED_IMG);
        this.setWidth(ImageConstants.BIG_PLANE_HITTED_WIDTH);
        this.setHeight(ImageConstants.BIG_PLANE_HITTED_HEIGHT);
        super.draw(g);
        try {
            Thread.sleep(Config.BIG_PLANE_STATUS_CHANGE_INTERVAL);
        } catch (InterruptedException ignore) {

        }

        this.setImage(Images.BIG_PLANE_BADDLY_WOUNDED_IMG);
        this.setWidth(ImageConstants.BIG_PLANE_BADDLY_WOUNDED_WIDTH);
        this.setHeight(ImageConstants.BIG_PLANE_BADDLY_WOUNDED_HEIGHT);
        super.draw(g);
        try {
            Thread.sleep(Config.BIG_PLANE_STATUS_CHANGE_INTERVAL);
        } catch (InterruptedException ignore) {

        }

        this.setImage(Images.BIG_PLANE_KILLED_IMG);
        this.setWidth(ImageConstants.BIG_PLANE_KILLED_WIDTH);
        this.setHeight(ImageConstants.BIG_PLANE_KILLED_HEIGHT);
        super.draw(g);
        try {
            Thread.sleep(Config.BIG_PLANE_STATUS_CHANGE_INTERVAL);
        } catch (InterruptedException ignore) {

        }

        this.setImage(Images.BIG_PLANE_ASHED_IMG);
        this.setWidth(ImageConstants.BIG_PLANE_ASHED_WIDTH);
        this.setHeight(ImageConstants.BIG_PLANE_ASHED_HEIGHT);
        super.draw(g);
        try {
            Thread.sleep(Config.BIG_PLANE_STATUS_CHANGE_INTERVAL);
        } catch (InterruptedException ignore) {

        }
    }

}
